﻿using Simple.Services;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 违章原因分析
/// </summary>
[Route("QHSEViolationClauseAnalysisController/[action]")]
[ApiController]
public class QHSEViolationClauseAnalysisController : ControllerBase
{
    private readonly ViolationClauseAnalysisService _violationClauseAnalysisService;
    private readonly QHSEXyViolationService _violationService;


    public QHSEViolationClauseAnalysisController(ViolationClauseAnalysisService violationClauseAnalysisService, QHSEXyViolationService violationService)
    {
        _violationClauseAnalysisService = violationClauseAnalysisService;
        _violationService = violationService;
    }

    /// <summary>
    /// 违章原因分析--原因列表
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> ViolationClauseAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationService.ViolationCauseAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章原因分析--违章工龄
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> WorkYearsAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationClauseAnalysisService.WorkYearsAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章原因分析--违章性质
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> ViolationTypeAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationClauseAnalysisService.ViolationTypeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章原因分析--各专业违章性质
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> WorkSpecialityAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationClauseAnalysisService.WorkSpecialityAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章原因分析--各年龄段违章性质
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> AgeAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationClauseAnalysisService.AgeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 违章原因分析--用工性质违章性质
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_violationClauseAnalysis")]
    public async Task<AppResult> EmployeeTypeAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var res = await _violationClauseAnalysisService.EmployeeTypeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
}
